
<!-- 正文开始 -->
<div class=" layui-form open-form">
    <div class="open-model">
        <div class="open-auto">

                  <div class="layui-form lay-header" style="margin-top: 20px;height: 60px">
                    <div class="toolbar">
                      <div class="layui-form-item lay-query-content">
                        <div class="lay-query-box">
                          <div class="query-lt">
                              <div class="layui-inline">
                                  <label class="layui-form-label w-auto">产线</label>
                                  <div class="layui-input-inline mr0">
                                      <input name="productionLineId" id="productionLineSearch" class="layui-input" type="hidden"/>
                                      <select id="productionLineSearchId" name="productionLineSearchId" lay-filter="productionLineSearchId" lay-search required></select>
                                  </div>
                              </div>
                              <div class="layui-inline">
                                  <label class="layui-form-label">生产计划编号</label>
                                  <div class="layui-input-inline mr0">
                                      <input name="productionSchedulingPlanCode" class="layui-input" type="text" placeholder="请输入生产计划编号" />
                                  </div>
                              </div>
                            <div class="layui-inline">
                              <button class="layui-btn icon-btn color-green" lay-filter="itemSubSearchTwo"
                                      lay-submit layui-form-keyDownSearch="true">查询
                              </button>
                              <button class="layui-btn icon-btn color-white" lay-filter="itemResetsTwo"
                                      lay-submit>重置
                              </button>
                            </div>
                          </div>
                          <div class="query-rt"></div>
                        </div>
                      </div>
                    </div>
                  </div>
            <div class="layui-form-item ">
                <button class="layui-btn" id="selectAll">确认选择</button>
            </div>
            <!-- 表格 -->
            <table class="layui-table" lay-filter="SelectTable" id="SelectTable"></table>

            <!--      <table class="layui-table" id="warehouseMaterialRequisitionRecordTable"-->
            <!--             lay-filter="warehouseMaterialRequisitionRecordTable"></table>-->
        </div>

    </div>
</div>

<script>
    layui.use(["layer", "form", "table", "admin", "laydate", "upload", "laytpl"], async function () {
        const table = layui.table;
        const config = layui.config;
        const laytpl = layui.laytpl;
        const form = layui.form;
        const admin = layui.admin;
        const layer = layui.layer;
        const upload = layui.upload;
        const laydate = layui.laydate;
        const $ = layui.jquery;
        const nowData = { ...parentData };
        console.log("nowData", nowData);
        // let url = 'warehouse/warehouse/productInventory/list'
        // if (nowData.productStatus){
        //   url = 'warehouse/warehouse/productInventory/list?productStatus=' + nowData.productStatus
        // }
        // 初始化产线下拉框
        admin.initDataSelectPro(
            "warehouse/warehouse/productionLine/list?page=1&limit=9999",  // 替换为实际请求地址
            { limit: 9999 }, // 参数
            "productionLineSearchId",  // 目标下拉框ID
            "产线",  // 下拉框标题
            async (d, obj) => {
                if(d.value){
                    $("#productionLineSearch").val(d.value)
                }
            },
            "productionLineName"  // 使用 productionLineName 作为显示文本
        );

        var tableTwo = table.render({
            elem: "#SelectTable",
            url: config.base + 'warehouse/warehouse/computerPractice/list?status=1',
            page: true,
            defaultToolbar: ["filter"],
            where: { access_token: config.getToken().access_token },
            cols: [
                [
                    { type: "radio" },
                    { type: "numbers", title: "序号" },
                    { field: "computerPracticeCode", align: "center", title: "上机记录编号" },
                    { field: "productionSchedulingPlanDetailCode", align: "center", title: "制令单编号" },
                    { field: "productionPlanCode", align: "center", title: "生产计划编号" },
                    { field: "plannedQuantity", align: "center", title: "计划生产数量" },
                    { field: "completedQuantity", align: "center", title: "已完成数量" },
                    { field: "productionLineName", align: "center", title: "生产线" },
                    // { field: "workshopName", align: "center", title: "所属车间" },
                    { field: "materialNumber", align: "center", title: "材料料号" },
                    { field: "userBundleCode", align: "center", title: "捆包码" },
                    { field: "sysBundleCode", align: "center", title: "唯一码" },
                    { field: "creatorName", align: "center", title: "操作人" },
                    { field: "createTime", align: "center", title: "操作时间" },
                ]
            ]
        });

        // 搜索
        form.on("submit(itemSubSearchTwo)", function (data) {
            tableTwo.reload({
                where: {
                    ...data.field,
                },
                page: { curr: 1 }
            });
        });

        // 重置搜索
        form.on("submit(itemResetsTwo)", function (data) {
            tableTwo.reload({
                where: {
                    ...admin.resetSearch(data.field),
                },
                page: { curr: 1 }
            });
        });

        form.render("select");


        $("#selectAll").click(function () {
            const checkStatus = table.checkStatus("SelectTable").data;
            console.log(checkStatus,"checkStatus")
            childData.SelectList = checkStatus;
            layer.close(nowData.zindex);
        });
    });
</script>

<style>
    .open-auto{
        position: relative;
        z-index: 10000;
        overflow: visible !important;
    }
    .layui-form-select dl{
        /*max-height:116.1px !important;*/
    }
</style>